{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "sexual-survey",
   "metadata": {},
   "outputs": [],
   "source": [
    "import re"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "gothic-lesbian",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['aaaaaaaa', 'bbb']"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "re.split(\"\\s+\", \"aaaaaaaa  bbb\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "christian-volunteer",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/reverse-words-in-a-string\n",
    "\n",
    "\n",
    "Runtime: 32 ms, faster than 74.08% of Python3 online submissions for Reverse Words in a String.\n",
    "Memory Usage: 14.5 MB, less than 43.34% of Python3 online submissions for Reverse Words in a String.\n",
    "\n",
    "\n",
    "```python\n",
    "import re\n",
    "\n",
    "class Solution:\n",
    "    def reverseWords(self, s: str) -> str:\n",
    "        #8:41\n",
    "        s = s.strip()\n",
    "        l = re.split(\"\\s+\", s)\n",
    "        l.reverse()\n",
    "        return \" \".join(l)\n",
    "        #8:43\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "caring-payment",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
